decision_tree_recp = recipe(diagnosis~.,data = train_data) |>
  step_smotenc(diagnosis,over_ratio=0.5 ,neighbors=1,seed=123,skip = TRUE)


decision_tree_spec = decision_tree() |>
  set_engine("rpart") |>
  set_mode("classification")

decision_tree_flow = workflow() |>
  add_recipe(decision_tree_recp) |>
  add_model(decision_tree_spec)


decision_tree_fit = fit(decision_tree_flow,data = train_data)
decision_tree_predict = augment(decision_tree_fit,new_data=test_data)

decision_tree_auc = roc_auc(data = decision_tree_predict,truth = diagnosis,.pred_1,event_level="second")
decision_tree_acc = accuracy(data = decision_tree_predict,truth = diagnosis,.pred_class)
decision_tree_sens = sensitivity(data=decision_tree_predict,truth = diagnosis,.pred_class,event_level = "second")
decision_tree_spec = specificity(data=decision_tree_predict,truth = diagnosis,.pred_class,event_level = "second")
decision_tree_ppv = ppv(data=decision_tree_predict,truth = diagnosis,.pred_class,event_level = "second")
decision_tree_conf_mat = conf_mat(data=decision_tree_predict,truth = diagnosis,.pred_class)
descrion_f_meas = f_meas(data=decision_tree_predict,truth = diagnosis,.pred_class,event_level = 'second')
# decision_evaluation_table <- tibble(
#   metric = c("auc", "acc","sens","spec","ppv"),
#   value = c(auc$.estimate, acc$.estimate,sens$.estimate,spec$.estimate,ppv$.estimate)
# )

# decision_evaluation_table

# conf_mat